#include "Logger.h"
namespace compiler{
	void Logger::debug(const char *s){
		cout<<s<<endl;
	}
	void Logger::info(const char *s){
		if(strm.is_open())
			strm<<s;
		cout<<s;
	}
	void Logger::info(const string *s){
		bool b;
		b=strm.is_open();
		if(strm.is_open())
			strm<<s->c_str();
		cout<<s->c_str();
	}
	void Logger::error(const char *s){
		if(strm.is_open())
			strm<<s;
		cout<<s;
	}
	void Logger::error(int i){
		if(strm.is_open())
			strm<<i;
		cout<<i;
	}
	void Logger::error(const char *s, int line, int loc){
		if(strm.is_open())
			strm<<s;
		cout<<s;
	}
	void Logger::wait(){
		int i;
		cin>>i;
	}
	Logger::~Logger()
	{
		if(strm.is_open())
			strm.close();
	}
	Logger::Logger()
	{
		strm.open("log.txt");
	}
	void Logger::end()
	{
		if(strm.is_open())
		{
			strm.close();
		}
	}
}